<template>
  <div id="newGoods">
    <div class="title">
      <p>{{ newGoodsList.name }}</p>
      <p>
        <a href="javascript:void(0)"  v-for="(item) in newGoodsList.palteTabList" :key="item.id">
          <span>{{item.name}}</span></a>
      </p>
    </div>
    <dl id="newGoodsList">
      <dd v-for="item in newGoodsList.goodsList" :key="item.id" @click="$routeJump(item.goodsId)">
        <div v-if="item.isNew==1" class="isNew">
          <div>新品</div>
        </div>
        <div class="goods-img">
          <img :src="item.imgUrl" >
        </div>
        <div class="goods-name">{{ item.goodsName }}</div>
        <div class="goods-price">{{handlerPrice(item.price)}}</div>
        <div style="height: 20px"></div>
      </dd>
    </dl>
  </div>
</template>

<script>
import { sharedMethods } from "@/mixin/index"
export default {
  name: "newGoods",
  props: {
      newGoodsList:{
        type:Object,
        default(){
          return {}
        }
      }
  },
  mixins: [sharedMethods]
}
</script>

<style scoped>
dl,dt,dd {
  margin: 0;
  padding: 0;
}
    #newGoods {
      width: 1200px;
      margin: 0 auto;
    }
    #newGoods > .title {
      height: 40px;
      display: flex;
      justify-content: space-between;
      margin: 40px 0 20px;
    }
    #newGoods > .title > p {
      margin: 0;
      color: #333;
      font-size: 26px;
      line-height: 40px;
    }
    #newGoods > .title > p span {
      color: #333;
      font-size: 16px;
    }
    #newGoods > .title > p span:hover {
      color: #0099a8;
    }
    #newGoods > .title > p span::after {
      content: " / ";
    }
    #newGoods > .title a:last-of-type > span::after {
      content: "";
    }
    #newGoodsList {
      width: 100%;
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      cursor: pointer;
    }
    #newGoodsList > dd {
      background: #fff;
      margin-bottom: 10px;
      position: relative;
      width: 292px;
    }
    #newGoodsList > dd > .isNew {
      display: flex;
      flex-direction: column;
      height: 45px;
      min-height: 20px;
      position: absolute;
      width: 50px;
      z-index: 100;
    }
    #newGoodsList > dd > .isNew > div {
      background-color: #ff4157;
      color: #fff;
      font-size: 12px;
      margin: 10px 0 0 10px;
      padding: 2px 5px;
      text-align: center;
      width: 50px;
    }
    #newGoodsList > dd > .goods-img {
      box-sizing: border-box;
      height: 280px;
      overflow: hidden;
      text-align: center;
    }
    #newGoodsList > dd > .goods-img > img {
      width: 250px;
      height: 250px;
      background-size: cover;
      padding-top: 20px;
      transition: all .6s;
    }
    #newGoodsList > dd > .goods-name {
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 2;
      color: #333;
      display: -webkit-box;
      font-weight: 400;
      margin: 0 auto;
      overflow: hidden;
      padding-top: 10px;
      text-overflow: ellipsis;
      width: 90%;
      text-align: start;
    }
    #newGoodsList > dd > .goods-price {
      color: #fc3538;
      font-size: 14px;
      font-weight: 600;
      margin: 10px auto;
      width: 90%;
      text-align: left;
    }
</style>